package com.example.demo.candycrush;

import com.example.demo.candycrush.model.ProcessResult;
import com.example.demo.candycrush.strategy.CrushStrategy;

import java.util.ArrayList;
import java.util.List;

public class CandyCrushProcessor {
    private final CrushStrategy strategy;
    
    public CandyCrushProcessor(CrushStrategy strategy) {
        this.strategy = strategy;
    }
    
    public List<String> process(String input) {
        List<String> steps = new ArrayList<>();
        steps.add(input);
        
        String current = input;
        while (true) {
            ProcessResult result = strategy.process(current);
            if (result == null) break;
            
            current = result.getResult();
            steps.add(current);
        }
        return steps;
    }
}